home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 7715 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  67 lines

  1. Path: jaring.my!usenet
  2. From: yinchau@pl.jaring.my (Choong Yin Chau)
  3. Newsgroups: comp.lang.c++
  4. Subject: [Help!] "Declaration syntax error" on interrupt program ?
  5. Date: Sun, 25 Feb 1996 16:07:22 GMT
  6. Organization: Unconfigured
  7. Message-ID: <4gq1mk$8bl@jaring.my>
  8. NNTP-Posting-Host: j3.glg51.jaring.my
  9. X-Newsreader: Forte Free Agent v0.55
  10.  
  11. Below is an example program from the Turbo C++ 3.0 Online Help.
  12. However when I run the program, an error message appeared at line
  13. "#####" stating that there is some "declaration syntax error" that I
  14. failed to find out.
  15.  
  16. Can anyone help me with my first involvement in "interrupts".  TQ.
  17.  
  18. ___________________________________________________
  19.  
  20. #include  <dos.h>
  21. #include  <conio.h>
  22.  
  23. void interrupt (*mybeep)( void )
  24. {                                                             #####
  25.   int      i, j;
  26.   char     originalbits, bits;
  27.   unsigned char   bcount = _AX >> 8;
  28.  
  29.   /* Get the current control port setting */
  30.   bits = originalbits = inportb(0x61);
  31.  
  32.   for (i = 0; i <= bcount; i++)
  33.   {
  34.     /* Turn off the speaker for awhile */
  35.     outportb(0x61, bits & 0xfc);
  36.     for (j = 0; j <= 100; j++)
  37.       ;   /* empty statement */
  38.  
  39.     /* Now turn it on for some more time */
  40.     outportb(0x61, bits | 2);
  41.     for (j = 0; j <= 100; j++)
  42.       ;   /* another empty statement */
  43.   }
  44.  
  45.   /* Restore the control port setting */
  46.   outportb(0x61, originalbits);
  47. }
  48.  
  49.  
  50. void main( void )
  51. {
  52.   void  interrupt  (*old_handler)(...);
  53.  
  54.   old_handler = getvect( 10 );
  55.   _AH = (unsigned)3;
  56.   setvect( 10 , mybeep );
  57.   geninterrupt( 10 );
  58.   getch();
  59.   setvect( 10 , old_handler );
  60. }
  61.  
  62. _____________________________________________
  63.  
  64.  
  65. E-mail addr.:  yinchau@pl.jaring.my
  66.  
  67.